<?xml version="1.0" encoding="UTF-8"?>

<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:param name="agent_name"></xsl:param>

<xsl:output method="text" encoding="UTF-8" omit-xml-declaration="yes" indent="no" media-type="text"/> 

	<xsl:template match="/">
		<xsl:apply-templates select="system/scenario/agents/agent"/>
	</xsl:template>
	
	<xsl:template match="system/scenario/agents/agent">
		<xsl:variable name="name" select="name" />
		<xsl:if test="$agent_name = $name">
import jade.core.Agent;
import jade.core.behaviours.*;

public class <xsl:value-of select="name" /> extends Agent
{
	private String description = "<xsl:value-of select="description" />";
	private Double x = new Double(<xsl:value-of select="x" />);
	private Double y = new Double(<xsl:value-of select="y" />);
	private Double width = new Double(<xsl:value-of select="width" />);
	private Double height = new Double(<xsl:value-of select="height" />);
	private Double weight = new Double(<xsl:value-of select="weight" />);
	<xsl:apply-templates select="behavior" />
}
		</xsl:if>
	</xsl:template>
	
	<xsl:template match="behavior">
		<xsl:for-each select="child::*">
			<xsl:choose>
				<xsl:when test="name() = 'oneshotbehavior'">
	private class <xsl:value-of select="name" /> extends OneShotBehavior
				</xsl:when>
				<xsl:when test="name() = 'cyclicbehavior'">
	private class <xsl:value-of select="name" /> extends CyclicBehavior
				</xsl:when>
				<xsl:when test="name() = 'weakerbehavior'">
	private class <xsl:value-of select="name" /> extends WakerBehavior
				</xsl:when>
				<xsl:when test="name() = 'tickerbehavior'">
	private class <xsl:value-of select="name" /> extends TickerBehavior			
				</xsl:when>
			</xsl:choose>
	{
		private String description = "<xsl:value-of select="description" />";
		
		public void action()
		{
		
		}
		
		public boolean done()
		{
			return true;
		}
	}
		</xsl:for-each>
	</xsl:template>

</xsl:transform>